<?php 
// 获取数据的

$link =  mysqli_connect("localhost","root","root","2113");

// 获取多条数据
if(!empty($_GET['sort'])){
	$age = $_GET['sort'];
	$sql = "SELECT * FROM student WHERE age>$age";
}else{
	$sql = "SELECT * FROM student ORDER BY id ASC";
}



$res =  mysqli_query($link,$sql);
// 执行结果集获取数据
$arr = [];
while($one=mysqli_fetch_assoc($res)){
	$arr[] = $one;
}
// echo "<pre>";
// print_r($arr);
// echo "</pre>";
// die;
$str =  json_encode($arr);
echo $str;
// echo "<h1>12121</h1>";

?>